Ext.define('Holo.view.trip.FormCreateTripDesc', {
    extend: 'Ext.form.Panel',
    alias : 'widget.createtripdesc',
    height: 200,
    width: 550,
    border :false,
    disabled : false, 
    bodyPadding: 10,
    frameHeader: false,
      initComponent: function() {
        var me = this;

        Ext.applyIf(me, {
            items: [
                {
                    xtype: 'combobox',
                    fieldLabel: Label.get('LAB902'),
                    name :'codelang',
                    store: GlobalData.storeChoiceLanguage,
                    queryMode: 'local',
                    allowBlank: false,
	            blankText:Error.get('ERR005'),
                    editable : false,
                    displayField: 'labelLang',
                    valueField: 'codeLang',
                    //choice validate if the language label is not all ready on the current TripDescriptionsLabel
                    validator : function (value){
                        clickedRecord = this.getStore().findRecord("labelLang", value) ;
                        if (clickedRecord !=null){
                            if (Ext.data.StoreManager.lookup('TripDescriptions').langExist(clickedRecord.get('codeLang'))){
                                return Error.get('ERR008');
                            }
                        }
                        return true;
                    }
                },{
                    xtype: 'textfield',
                    name :'title',
                    fieldLabel: Label.get('LAB060'),
                    maxLength:60,
                    width: 350,
                    allowBlank: false,
	            blankText:Error.get('ERR005'),
                    maxLengthText:Error.get('ERR003'),
                    minLength:5,
                    minLengthText:Error.get('ERR002')
                },{
                    xtype: 'textareafield',
                    name :'description',
                    fieldLabel: Label.get('LAB061'),
                    maxLength:1000,
                    allowBlank: true,
                    width: 350,
                    height :70,
	            blankText:Error.get('ERR005'),
                    maxLengthText:Error.get('ERR003'),
                    minLength:0,
                    minLengthText:Error.get('ERR002')
                }
            ],
            buttons :[{
                        text: Label.get('LAB901'),
                        action:'createtripdesc',
                        formBind: true, //only enabled once the form is valid
                        disabled: true
                    }]
        });

        me.callParent(arguments);
    }
});